package demo01;

/**
 * @program: 12.2
 * @description:
 * @author: 李鑫月
 * @create: 2021-12-03 20:48
 **/
class MyArrayList<E>{
   private E[] elem;
    private int usedSize;
    public MyArrayList(){
        this.elem= (E[]) new Object[10];
    }
    public void add(E val){
        this.elem[usedSize]=val;
        usedSize++;
    }
    public E get(int pos){
        return this.elem[pos];
    }
}
public class Demo02 {
    public static void main(String[] args) {
    MyArrayList<String> myArrayList=new MyArrayList<>();
    MyArrayList<Integer> myArrayList2=new MyArrayList<>();
    myArrayList.add("zz");
    String s=myArrayList.get(0);
        System.out.println(s);
//    myArrayList.add(1);
    }
}
